home *** CD-ROM | disk | FTP | other *** search
/ Internet Tools (InfoMagic) / Internet Tools.iso / dos_win / winsock / hacklist / 94-04.Z / 94-04 / 000003_carlp@onpmomma.isc-br.com_Fri Apr 1 23:36:33 1994.msg < prev    next >
Internet Message Format  |  1994-04-30  |  6KB

  1. Received: from onpmomma.isc-br.com by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
  2.           id AA09918; Sat, 2 Apr 1994 10:37:41 -0500
  3. Received: by onpmomma.isc-br.com (Smail3.1.28.1 #3)
  4.     id m0pn7kP-000A9lC; Sat, 2 Apr 94 07:36 PST
  5. Message-Id: <m0pn7kP-000A9lC@onpmomma.isc-br.com>
  6. Subject: Re: What does send() returning 0 mean ? revisited
  7. To: rcq@ftp.com
  8. Date: Sat, 2 Apr 94 7:36:33 PST
  9. From: Carl Paukstis <carlp@onpmomma.isc-br.com>
  10. Cc: winsock-hackers@sunsite.unc.edu
  11. In-Reply-To: <9403311447.AA11710@mailserv-D.ftp.com>; from "Bob Quinn" at Apr 1, 94 8:32 pm
  12. X-Mailer: ELM [version 2.3 PL11]
  13.  
  14. Bob Quinn writes:
  15. >
  16. >Since there is no obvious reason to reject a length of zero (it's
  17. >not a useful request, but it's not a harmful one), we return 0.
  18.  
  19. >should not fail without good reason.  Since there are unforeseen
  20. >conditions under which an application can sometimes mistakenly
  21. >try to send 0 bytes, there's no reason for the DLL to punish
  22. >them for it.
  23.  
  24. <APPLAUSE>
  25.  
  26. Right answer, Bob!
  27.  
  28. -- 
  29. Carl Paukstis, RRR&RSG   DoD#0432 1KQSPI=8.80   carlp@mail.spk.olivetti.com
  30. Olivetti North America                          carlp@mom.isc-br.com
  31. (Oli North): will deny responsibility    voice: (509) 927-5439 0700-1600 M-F
  32. Spokane, Washington, USA                   FAX: (509) 927-2499 24 hrs.
  33. From paul@atlas.dev.abccomp.oz.au Tue Apr  5 11:18:55 1994
  34. Received: from usage.csd.unsw.OZ.AU by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
  35.           id AA29470; Tue, 5 Apr 1994 02:05:55 -0400
  36. Received: by usage.csd.unsw.OZ.AU id AA13525
  37.   (5.65c/IDA-1.4.4 for winsock-hackers%sunsite.unc.edu); Tue, 5 Apr 1994 16:05:58 +1000
  38. Received: by atlas (4.1/1.35)
  39.     id AA09083; Tue, 5 Apr 94 16:18:56 EST
  40. Message-Id: <9404050618.AA09083@atlas>
  41. From: paul@atlas.abccomp.oz.au
  42. Date: Tue, 5 Apr 1994 16:18:55 -0500
  43. X-Mailer: Mail User's Shell (7.2.2 4/12/91)
  44. To: alun@internet.wst.com,
  45.         Multiple recipients of list <winsock-hackers@sunsite.unc.edu>
  46. Subject: Re: Winsock on top of DOS stacks.
  47.  
  48. Thus expounded Alun Jones on Apr 1,10:50pm:
  49. /--------------------
  50. |If Windows exits unexpectedly, and yet the DOS subsystem is still
  51. |running, and if the underlying TCP/IP stack is a DOS-based system (and
  52. |still running), should all connected/listening sockets be closed?
  53. |Under at least one implementation, for instance, when going back into
  54. |windows, my ftp daemon won't start, because (it claims) the ftp port
  55. |is being listened on by some other process (presumably my previous
  56. |instance under windows).
  57.  
  58. I would have thought the DLL, if at all possible, should keep track of
  59. sockets owned by a given application, and clean them up if the
  60. application exits. A DLL has a routine called when the DLL
  61. itself is unloaded (i.e. when the last application using WINSOCK exits)
  62. which can be used to perform this cleanup. Of course, if 
  63. Windows crashes out so this routine is never called, then the DOS
  64. subsystem has no way of knowing there is no longer an application
  65. to own the sockets. And if there was a socket with a WSAAsyncSelect active,
  66. in all likelyhood the next callback will crash DOS as well.
  67.  
  68. If by 'exist unexpectedly' you mean Windows crashing out to the DOS prompt
  69. without exiting cleanly, then it would be unlikely that the DOS
  70. system will cleanly close the sockets for you. If Windows exits cleanly,
  71. then yes, the DLL should close all outstanding sockets before it
  72. exits.
  73.  
  74.  
  75. -- 
  76. Paul Brooks              |paul@abccomp.oz.au       |Emerging Standard:
  77. TurboSoft Pty Ltd        |pwb@newt.phys.unsw.edu.au|  one that has not yet
  78. 579 Harris St., Ultimo   |                         |  been superseded.
  79. Sydney Australia 2007    |ph: +61 2 281 3155       |  
  80. From bryan%alex.com@gateway.alex.com Tue Apr  5 06:20:43 1994
  81. Received: from post.demon.co.uk by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
  82.           id AA21145; Tue, 5 Apr 1994 06:20:43 -0400
  83. Received: from gateway.alex.com by post.demon.co.uk id aa05038;
  84.           5 Apr 94 11:17 GMT-60:00
  85. Return-Path: <bryan@alex.com>
  86. Received: from SKID by woody.alex.com (4.1/SMI-4.1)
  87.     id AA28610; Tue, 5 Apr 94 11:01:27 BST
  88. Date: Tue, 5 Apr 94 11:01:27 BST
  89. Message-Id: <9404051001.AA28610@woody.alex.com>
  90. X-Sender: bryan@alex.com
  91. Mime-Version: 1.0
  92. Content-Type: text/plain; charset="us-ascii"
  93. To: winsock-hackers@sunsite.unc.edu
  94. From: Bryan Boreham <bryan@alex.com>
  95. Subject: Re: Closing and reusing sockets
  96. X-Mailer: <PC Eudora Version 1.4>
  97.  
  98. > From: paul@atlas.abccomp.oz.au
  99.  
  100. > [loads of stuff -- should one call bind?]
  101.  
  102. > Now, the twist from your last sentence (above) is that you want to
  103. > bind() and connect() from a free reserved port - only in this case is
  104. >                             ---- ======== ----
  105. > it necessary or recommended to call bind() before connect().
  106.  
  107. Thanks for this confirmation.
  108.  
  109. > To avoid WSAEADDRINUSE errors, you must make sure a socket is fully closed
  110. > before you can connect _from_the_same_port_number_ to the same remote
  111. > machine listening on the _same_remote_port_ - possibly by blocking in 
  112. > a lingering close, or using linger to hard-close the connection when
  113. > you're done the first time.
  114.  
  115. This is roughly what I said in the very first message in this thread -- 
  116. hard-closing
  117. the socket makes the problem go away.  I guess that waiting for the close to
  118. complete (probably not actually blocking, given that we're all nice cooperative
  119. Windows programmers) is gentler, but it would complicate the exit logic of the
  120. program rather a lot.
  121.  
  122. This would all be a lot easier if we could rely on bind() giving EADDRINUSE 
  123. so that the next port could be used instead, and leave the stack to
  124. get on with closing down the old one quietly.
  125.  
  126. Bryan.